<template>
  <div class="hello">
    <h2>Q-DMS数据挖掘系统</h2>
    <el-link style="font-size: 24px;" href="https://gitee.com/chuyangc" type="info"><i class="el-icon-view el-icon--right"></i>我的主页</el-link>
    <h1>{{ currentTime }}</h1>
  </div>
</template>

<script>
export default {
  name: 'Author@chuyangc',
  methods : {
  },
  data() {
    return {
      timer: "",//定义一个定时器的变量
      currentTime: new Date(), // 获取当前时间
    };
  },
  created() {
    var _this = this; //声明一个变量指向Vue实例this，保证作用域一致
    this.timer = setInterval(function() {
      _this.currentTime = //修改数据date
        new Date().getFullYear() +
        "-" +
        (new Date().getMonth() + 1) +
        "-" +
        new Date().getDate() +
        " " +
        new Date().getHours() +
        ":" +
        new Date().getMinutes() +
        ": " +
        new Date().getSeconds();
    }, 1000);
  },
  beforeDestroy() {
    if (this.timer) {
      clearInterval(this.timer); // 在Vue实例销毁前，清除我们的定时器
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
